<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- 单个复选框主要用来勾选或者取消勾选,一般用一个boolean值控制状态 -->
        <input type="checkbox" v-model="check">是否同意遵守此协议
        <br>
        <hr>
        <!-- 多个复选框,常见场景是收集表单数据,所以data初始值可以设置一个数组收集这些数据 -->
        <form action="javascript:;">
            <input type="checkbox" name="city" value="武汉" v-model="city">武汉
            <input type="checkbox" name="city" value="广州" v-model="city">广州
            <input type="checkbox" name="city" value="深圳" v-model="city">深圳
            <input type="checkbox" name="city" value="宁夏" v-model="city">宁夏
        </form>
    </div>
    <script>
        new Vue({
            el: "#app",
            data() {
                return {
                    check: true,
                    city: []
                }
            }
        })
    </script>
</body>

</html>